//
//  GYInvoiceTitleTableViewCell.m
//  GoodLuck
//
//  Created by apple on 2018/4/2.
//  Copyright © 2018年 yunjiazhineng. All rights reserved.
//

#import "GYInvoiceTitleTableViewCell.h"

static NSString *invoiceTitleCellIdentifier = @"invoiceTitleCellIdentifier";

@interface GYInvoiceTitleTableViewCell ()<UITextFieldDelegate>



@end

@implementation GYInvoiceTitleTableViewCell

+ (instancetype)cellWithTableView:(UITableView *)tableView {
    GYInvoiceTitleTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:invoiceTitleCellIdentifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] firstObject];
    }
    
    return cell;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    [self.invoiceTitleTF addTarget:self action:@selector(returnBtuClick) forControlEvents:UIControlEventEditingDidEndOnExit];
}

- (void)returnBtuClick {
    [self.invoiceTitleTF resignFirstResponder];
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
    self.invoiceTitleCallBack(textField.text);
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self endEditing:YES];
}

@end
